package cn.gailvlun.gll.net.emotion;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.util.Date;


public class EmotionSource implements Parcelable {


    

    private int id;
    private String text;
    private String pic;
    private EmotionEnum emotion_type;
    private SourceType category;
    private String source;
    private Date created;
    @SerializedName("image_height")
    private Integer imageHeight;
    @SerializedName("image_width")
    private Integer imageWidth;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public EmotionEnum getEmotion_type() {
        return emotion_type;
    }

    public void setEmotion_type(EmotionEnum emotion_type) {
        this.emotion_type = emotion_type;
    }

    public SourceType getCategory() {
        return category;
    }

    public void setCategory(SourceType category) {
        this.category = category;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public void setImageHeight(Integer imageHeight) {
        this.imageHeight = imageHeight;
    }

    public Integer getImageHeight() {
        return imageHeight;
    }

    public void setImageWidth(Integer imageWidth) {
        this.imageWidth = imageWidth;
    }

    public Integer getImageWidth() {
        return imageWidth;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.text);
        dest.writeString(this.pic);
        dest.writeInt(this.emotion_type == null ? -1 : this.emotion_type.ordinal());
        dest.writeInt(this.category == null ? -1 : this.category.ordinal());
        dest.writeString(this.source);
        dest.writeLong(this.created != null ? this.created.getTime() : -1);
        dest.writeValue(this.imageHeight);
        dest.writeValue(this.imageWidth);
    }

    public EmotionSource() {
    }

    protected EmotionSource(Parcel in) {
        this.id = in.readInt();
        this.text = in.readString();
        this.pic = in.readString();
        int tmpEmotion_type = in.readInt();
        this.emotion_type = tmpEmotion_type == -1 ? null : EmotionEnum.values()[tmpEmotion_type];
        int tmpCategory = in.readInt();
        this.category = tmpCategory == -1 ? null : SourceType.values()[tmpCategory];
        this.source = in.readString();
        long tmpCreated = in.readLong();
        this.created = tmpCreated == -1 ? null : new Date(tmpCreated);
        this.imageHeight = (Integer) in.readValue(Integer.class.getClassLoader());
        this.imageWidth = (Integer) in.readValue(Integer.class.getClassLoader());
    }

    public static final Creator<EmotionSource> CREATOR = new Creator<EmotionSource>() {
        @Override
        public EmotionSource createFromParcel(Parcel source) {
            return new EmotionSource(source);
        }

        @Override
        public EmotionSource[] newArray(int size) {
            return new EmotionSource[size];
        }
    };
}
